<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <title>Document</title>
</head>
<body>
    <div id="app">
        <h1>这个根实例模板中的内容{{info}}</h1>
        <my-comp></my-comp>
        <my-test></my-test>
    </div>
    <template id="t">
        <div>
            
            <h1 style="color:red">{{info}}</h1>
            <!--不会在页面出现，原因是myComp是一个局部组件-->
            <my-comp></my-comp>
        </div>
    </template>
    <script>
        new Vue({
            el:"#app",
            data: {
                info:"not can not up"
            },
            //定义局部组件
            components:{
                'MyComp':{
                    template:`<div><h1>你的梦想？{{as}}</h1></div>`,
                    data(){
                        return{
                        as:"进厂打螺丝"
                    }
                }
            },
                'myTest': {
                    template: "#t",
                    data() {
                        return {
                            info: "螺丝厂需要你!",
                        }
                    }
                },
            }
            
            
        })
    </script>
</body>
</html>